import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Viento here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */

public class Viento extends Elemento
{

    private Ventilador ven;
    private int tipo;
    private double d;
    private int xmundo;
    private int ymundo;
    private int ang;
    private double x;
    private double y;
    
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public Viento(Ventilador v,int t)
    {
        tipo=t;
        ven=v;
         d = -1;
        xmundo =0;
        ymundo =0;
    }

    /**
     * Act - do whatever the Viento wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        choque();
         if(d==-1)// Add your action code here.
            this.inicia();
    
    }  
    
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public void choque()
    {
       Jugador j=(Jugador)getOneIntersectingObject(Jugador.class);
       if(j!=null)
       {
       switch(tipo)
       {case 0:
           j.cambiaX(5);
           break;
        case 1:
           j.cambiaX(-5);
           break;
       }
       
       }
    }

    
    
}
